package com.zt.bus.order.inter;

import com.zt.bus.order.model.OrderDetail;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface OrderDetailMapper {
    int deleteByPrimaryKey(String id);

    int insert(OrderDetail record);

    OrderDetail selectByPrimaryKey(String id);

    int updateByPrimaryKeySelective(OrderDetail record);

    int updateByPrimaryKey(OrderDetail record);

    void insertBatch(List<OrderDetail> orderDetails);

    List<OrderDetail> selectByOrderId(@Param("orderId") String orderId);

    /**
     * 获取退订明细
     * 
     * @param orderBackId
     * @return
     */
    List<OrderDetail> selectByOrderBackId(@Param("orderBackId") String orderBackId);

    /**
     * 获取未发车订单，包括已开线路今天之后的，或者是待开线路的所有订单
     * 
     * @param planId
     * @return
     */
    List<OrderDetail> selectByPlanIdAndStartDate(@Param("planId") String planId, @Param("startDate") Date startDate);
    
    List<OrderDetail> selectByPlanIdAndPassengerPhone(@Param("planId") String planId, @Param("passengerPhone") String passengerPhone);

    OrderDetail selectByOrderIdAndPassengerPhoneAndRideDate(@Param("orderId") String orderId,
            @Param("passengerPhone") String passengerPhone, @Param("rideDate") Date rideDate);
    
    List<OrderDetail> selectByPlanIdAndPassengerPhoneAndRideDate(@Param("planId") String planId,
    		@Param("passengerPhone") String passengerPhone, @Param("rideDate") Date rideDate);
    
    List<OrderDetail> selectByPlanIdAndRideDate(@Param("planId") String planId, @Param("rideDate") Date rideDate);

    void updateStatusById(@Param("orderDetailId") String orderDetailId,
            @Param("orderDetailStatus") String orderDetailStatus);
}
